package base.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DTO.User;

/**
 * Servlet implementation class OptionTest
 */
public class OptionTest extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public OptionTest() {
	super();
    }

    protected void doGet(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {
	doPost(request, response);
    }

    protected void doPost(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {
	User user1 = new User();
	user1.setAccount("titus");
	user1.setAlias("jin");

	User user2 = new User();
	user2.setAccount("joy");
	user2.setAlias("wang");

	List result = new ArrayList();
	result.add(user1);
	result.add(user2);

	request.setAttribute("resultList", result);
	RequestDispatcher view = request
		.getRequestDispatcher("/WEB-INF/views/option.jsp");
	view.forward(request, response);
    }

}
